using System;
using System.Collections.Generic;
using System.Text;

namespace Mud.EmlenMudMain
{
	public class RandomNumbers
	{
		protected Random randgen;

		public RandomNumbers()
		{
			randgen = new Random();
		}

    public int number_range(int i1, int i2) { return RandIntBetween(i1, i2); }

		public double RandDoubleBetween(double d1, double d2) { double d = ((d2 - d1) * randgen.NextDouble()) + d1; return d; }
		public int RandIntBetween(int i1, int i2) { return randgen.Next(i1, i2); }
		public int Fuzzy(int n, int nPercent)
		{
			int nRangeLow = ((n * 100) - (n * nPercent));
			int nRangeHigh = ((n * 100) + (n * nPercent));
			int nNum = (nRangeLow <= nRangeHigh) ?
				RandIntBetween(nRangeLow, nRangeHigh) :
				RandIntBetween(nRangeHigh, nRangeLow);
			return nNum / 100;
		}

	}
}
